#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <vector>
#include <map>
#include <queue>
#include <cstdio>
#include <string>
#include <stack>
#include <set>
#define IOS ios::sync_with_stdio(false), cin.tie(0)
using namespace std;
typedef long long ll;
ll a,b;
ll chong;
int main()
{
    IOS;
    ll t;
    cin>>t;
    while(t--){
        chong=0;
        cin>>a>>b;
        ll k1=log(a)/log(4);
        ll k2=log(b)/log(7);
        
    }    
    getchar();
    getchar();
    return 0;
}
